package com.guw.Swing;

import javax.swing.*;
import java.awt.*;
import java.net.URL;

public class JButtonDemo extends JFrame {

    public JButtonDemo(){
        Container container = this.getContentPane();

        URL url = JButtonDemo.class.getResource("m11.png");
        Icon icon = new ImageIcon(url);

        JButton jButton = new JButton();
        jButton.setIcon(icon);
        jButton.setToolTipText("图片按钮");

        container.add(jButton);

        this.setVisible(true);
        this.setBounds(100,100,500,600);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new JButtonDemo();
    }
}
